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yA3ddZzZxqd1bIO6PZMoBvapvJasdrfGxW23ywDLbXPYADB1Sa4
bGuXlnADbup+WcAAAAAAAAAAAAD/2Q=="""
)

decoder = jpegio.JpegDecoder()


def decode_common(content, scale):
    w, h = decoder.open(content)
    bitmap = Bitmap(w >> scale, h >> scale, 65535)
    decoder.decode(bitmap, scale=scale)
    return bitmap


def decode_blinka(scale):
    return decode_common(content, scale)


def decode_resource(rsrc, scale):
    rsrc = __file__.rsplit("/", 1)[0] + "/" + rsrc + ".jpg"
    with open(rsrc, "rb") as f:
        return decode_common(f, scale)
